package com.zjht.gmcc.servlet.sys;

/* 
 * @author wxj
 * @version 1.4
 * ���ܣ��û�ɾ��
 * 2006-12-27
 */

import java.io.PrintWriter;
import java.sql.PreparedStatement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zjht.gmcc.bean.BaseServlet;

import com.zjht.gmcc.bean.util.MyJDBC;

public class OperDel extends BaseServlet {

	private static final long serialVersionUID = 1L;

	public boolean process(HttpServletRequest request, HttpServletResponse response, HttpSession session, PrintWriter out, MyJDBC myJDBC, String menu)
			throws Exception {
		int i_flag = 0;

		// ===============
		String s_orgacode = request.getParameter("orgacode");
		String s_opercode = request.getParameter("usercode");
		// =======================

		String url = "/sys/orga/opers.jsp?orgacode=" + s_orgacode;

		String s_sql = null;
		PreparedStatement ps = null;
		// ResultSet rs = null;

		s_sql = "delete from operspopedom where opercode=?";
		ps = myJDBC.prepareStatement(s_sql);
		ps.setString(1, s_opercode);
		i_flag = ps.executeUpdate();
		s_sql = null;
		ps.close();
		ps = null;

		if (i_flag != 0) {
			s_sql = "delete from opers where opercode=?";
			ps = myJDBC.prepareStatement(s_sql);
			ps.setString(1, s_opercode);
			i_flag = ps.executeUpdate();
			s_sql = null;
			ps.close();
			ps = null;
		}

		String act = "用户删除成功";
		if (i_flag > 0) {
			alert(out, act + "成功", url);
		
		} else {
			errAlert(request, out, act + "失败", url);
		}
		return i_flag > 0;

	}

}
